<?php

/**
 * FaqCategory actions.
 *
 * @package    sf_sandbox
 * @subpackage FaqCategory
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $
 */
class FaqCategoryActions extends autoFaqCategoryActions
{
  public function executeDelete()
  {
    $this->faq_categories = FaqCategoriesPeer::retrieveByPk($this->getRequestParameter('id'));
    $this->forward404Unless($this->faq_categories);

    try
    {
      if(!$this->deleteFaqCategories($this->faq_categories)){
      		$this->getRequest()->setError('delete', 'Không xóa được chủ để này vì tồn tại câu hỏi.');
      	 	return $this->forward('FaqCategory', 'list');
      }
    }
    catch (PropelException $e)
    {
      $this->getRequest()->setError('delete', 'Could not delete the selected Faq categories. Make sure it does not have any associated items.');
      return $this->forward('FaqCategory', 'list');
    }

    return $this->redirect('FaqCategory/list');
  }
   protected function deleteFaqCategories($faq_categories)
  {
    return $faq_categories->delete();
  }
  
}
